<template>
    <div>
        <van-nav-bar title="短信验证登录/注册" />
        <van-form @submit="onSubmit">
            <van-cell-group inset>
                <van-field v-model="sjh" name="sjh" label="手机号" placeholder="手机号"
                    :rules="[{ required: true,phone, message: '请填写手机号' }]" />
                <van-field v-model="sms" center clearable label="短信验证码" placeholder="请输入短信验证码"
                :rules="[{ required: true, message: '请填写验证码' }]" >
                    <template #button>
                        <van-button size="small" type="primary" @click="yzm" >发送验证码</van-button>
                    </template>
                </van-field>

            </van-cell-group>
            <div style="margin: 16px;">
                <van-button round block type="primary" native-type="submit">
                    提交
                </van-button>
            </div>
        </van-form>
    </div>
</template>

<script setup>
import router from "@/router";
import { ref } from 'vue';
const sjh = ref('')
const sms = ref('')
  const onSubmit = () => {
      router.push('/home')
    };
const phone = /^1[3-9]\d{9}?/
const yzm=()=>{
sms.value=123456
// let yzmer=ref('')
// console.log(yzmer);

}
</script>

<style lang="scss" scoped></style>